<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
</head>
<body>
<div id="app">
    <p v-upper-text="msg"></p>
    <p v-lower-text="msg"></p>
</div>
<div id="app1">
    <p v-upper-text="msg"></p>
    <p v-lower-text="msg"></p>
</div>
<script>
    Vue.directive('upper-text',(el,binding)=>{
        // el指令属性所在的标签对象
        // binding 包含指令相关信息数据对象
        console.log(el,binding)
        el.textContent=binding.value.toUpperCase()
    })
    // Vue.directive('lower-text',(el,binding)=>{
    //     el.innerText=binding.value.toLowerCase()
    // })
    new Vue({
        el:'#app',
        data:{
            msg:'Nba I Love This Game'
        },
        methods:{}
    })
    new Vue({
        el:'#app1',
        data:{
            msg:'Just Do It'
        },
        methods:{},
        directives:{
            'lower-text'(el,binding){
                el.innerText=binding.value.toLowerCase()
            }
        }
    })
</script>
</body>
</html>
